class Solution(object):
    def canReorderDoubled(self, arr):
        p = []
        n = []
        z_c = 0
        for a in arr:
            if a > 0:
                p.append(a)
            if a < 0:
                n.append(a)
            if a == 0:
                z_c += 1
        p.sort()
        n.sort(reverse=True)
        p_dict = {}
        n_dict = {}
        for a in p:
            if a / 2 in p_dict:
                p_dict[a / 2] -= 1
                if p_dict[a / 2] == 0:
                    p_dict.pop(a / 2)
            else:
                p_dict[a] = p_dict.get(a, 0) + 1
        if len(p_dict) > 0:
            return False
        for a in n:
            if a / 2 in n_dict:
                n_dict[a / 2] -= 1
                if n_dict[a / 2] == 0:
                    n_dict.pop(a / 2)
            else:
                n_dict[a] = n_dict.get(a, 0) + 1
        if len(n_dict) > 0:
            return False
        return True

data = Solution()
arr = [3, 1, 3, 6]
print(data.canReorderDoubled(arr))
arr = [2, 1, 2, 6]
print(data.canReorderDoubled(arr))
arr = [4, -2, 2, -4, 0, 0]
print(data.canReorderDoubled(arr))
